The present invention is generally related to frequency measurement methods and systems. The present is also related to pulse signal measurement methods and systems. The present invention is additionally related to timer clock and crystal controlled oscillator devices. The present invention is additionally related to frequency measurement circuits.
The frequency measurement of a periodic pulse signal can be defined as the average number of pulses evaluated over a time period. In a typical micro controller, a crystal-controlled oscillator can generate a timer clock, which is utilized as a reference for the measurement. The accuracy of the timer clock is very accurate. The actual measurement of the pulse signal, however, can introduce unacceptable accuracy. For some measurement techniques that are accurate at high frequencies, the low frequency measurements are inaccurate. Other methods that are inaccurate at low frequencies can be prone to be inaccurate at high frequencies.
FIG. 1 depicts a prior art timing diagram 10 illustrating a pulse count over a fixed period. One technique for calculation involves counting the number of pulses that occurred over a fixed period of time. In such a technique, as illustrated in FIG. 1, a timer and a counter can be initiated simultaneously. The timer is set to expire after a predetermined amount of time. The counter can count the number of pulses that occur while the timer is enabled. When the timer terminates, the counter will stop. The number of counts that occurs at the end of the period is divided by the time period to determine frequency. As indicated in timing diagram 10 of FIG. 1, a pulse input signal 12 indicates the number of pulses that occur a fixed measurement period 16, while a timer clock 14 (i.e., timer) runs over the fixed measurement period 16. In general, the percent accuracy of this measurement technique can be determined by the following formulation of equation (1):                               Percent          ⁢                      xe2x80x83                    ⁢          Accuracy                =                  100          ⁢          %          xc3x97                      2                          Number              ⁢                              xe2x80x83                            ⁢              Pulse              ⁢                              xe2x80x83                            ⁢              Counted              ⁢                              xe2x80x83                            ⁢                              (                M                )                                                                        (        1        )            
Additionally, frequency can be determined according to the formulation indicated in equation (2):
xe2x80x83Frequency=Number of Pulses/Time Periodxe2x80x83xe2x80x83(2)
The approach illustrated in FIG. 1 is limited because the first and last pulses that are counted are not synchronized to the measurement timer clock 14. This can result in an error of up to two pulse times. At high frequencies, this may be insignificant because at a high frequency, the number of pulses counted over a measurement period is very large and an error of two pulses is relatively small. At lower frequencies, the number of pulses counted becomes proportionally smaller. As a result, the accuracy of the measurement decreases as the frequency decreases. At frequencies close to the sample period, accuracy can exceed 100%.
FIG. 2 illustrates a prior art timing diagram 20 illustrating pulse time measurement for a fixed number of pulses. In the approach illustrated by timing diagram 20 of FIG. 2, the time between one or more pulses is measured. Timing diagram 20 depicts a timer clock 26 and a pulse input signal 24. A time period 22 extends over a range of pulses generated by pulse input signal 24. The technique illustrated in FIG. 2 can solve the low frequency inaccuracy inherent with the method discussed above with reference to FIG. 1. In the method illustrated in FIG. 2, however, a timer (i.e., timer clock 26) is initiated by an enable signal that is triggered at the rising edge of an input pulse. A counter can then be used to count a particular number of pulses. After a predetermined number of pulses have been counted, a trigger generated by the rising edge of the next input signal disables the timer. In general, timing diagram indicates that the timing measurement takes place for a fixed number of pulses. Percent accuracy can be calculated according to the formulation of equation (3):                               Percent          ⁢                      xe2x80x83                    ⁢          Accuracy                =                  100          ⁢          %          xc3x97                                    Input              ⁢                              xe2x80x83                            ⁢              Frequency                                      Timer              ⁢                              xe2x80x83                            ⁢              Frequency                                                          (        3        )            
The measurement method illustrated in FIG. 2 permits the pulse input frequency to be determined by dividing the number of pulses (which is a constant) by the measurement time period. Frequency can be determined according to the following formulation of equation (4):                     Frequency        =                              (                          Sample              ⁢                              xe2x80x83                            ⁢              Clock              ⁢                              xe2x80x83                            ⁢              Rate                        )                    xc3x97                                    Number              ⁢                              xe2x80x83                            ⁢              of              ⁢                              xe2x80x83                            ⁢              Pulses              ⁢                              xe2x80x83                            ⁢                              (                M                )                                                    Measured              ⁢                              xe2x80x83                            ⁢              Time              ⁢                              xe2x80x83                            ⁢              Period              ⁢                              xe2x80x83                            ⁢                              (                N                )                                                                        (        4        )            
where
M=Set Number of Pulses (Constant)
N=Number of Clock Pulses that Elapse
The method illustrated in FIG. 2 provides good accuracy at lower frequencies where the pulse count is small compared to the timer clock frequency. In order to make low frequency measurements in a reasonable amount of time, the number of pulses that are counted is relatively small. For example, in order to measure a 10 Hz signal at least once every 200 milliseconds, a pulse count of 2 can be used. This is fine for low frequencies; however, at a higher frequency this small number of pulses can result in inaccuracy caused by the resolution of the timer/counter. For example, at 100 kHz, 2 pulses will occur in 20 microseconds. The resolution of a 1 megahertz timer counter is 1 microsecond. This results in an error of 1 part in 20 or 5%.
Besides the error being dependent on the input frequency, so is the acquisition period. The amount of time is inversely proportional to the input frequency. This makes it inconvenient to apply to measurement processes that require a predictable amount of time to perform input acquisition.
Based on the foregoing, the present inventors have concluded that a need exists for a method and system for determining the frequency of a pulse input signal over a wide frequency range. Such a method and system, if implemented properly, should additionally result in highly accurate measurement results over a wide frequency range. A need also exists for an improved method and system for measuring pulse frequency, unlike previous techniques, which focus on the measurement of power of a signal with regard to a reference signal.
The following summary of the invention is provided to facilitate an understanding of some of the innovative features unique to the present invention, and is not intended to be a full description. A full appreciation of the various aspects of the invention can be gained by taking the entire specification, claims, drawings, and abstract as a whole.
It is therefore one aspect of the present invention to provide an improved method and system for measuring frequency.
It is another aspect of the present invention to provide a method and system for reliably measuring the frequency of an input periodic pulse signal over a wide frequency range.
It is still another aspect of the present invention to provide a frequency measurement method and system whose measurement accuracy is dependent only upon a reference timer clock.
It is yet another aspect of the present invention to provide a frequency measurement method and system whose measurement accuracy is constant over an entire specified frequency range.
It is yet another aspect of the present invention to provide a measurement method and system, which provides a measurement acquisition time that is predictable regardless of the frequency of the measured signal.
The above and other aspects can be achieved as is now described. A method and system for determining the frequency of a pulse input signal is disclosed herein. A pulse count and a timer count can be captured at a start and end of a predetermined measurement interval to thereby obtain a start pulse count and an end pulse count and a start pulse time and an end pulse time thereof. A pulse frequency can then be determined, wherein the pulse frequency comprises the end pulse count minus the start pulse count divided by the end pulse time minus the start pulse time, thereby permitting a highly accurate frequency measurement of the pulse input signal to be obtained over a wide frequency range. The pulse count and the timer count can be captured respectively utilizing a pulse counter and a timer. The pulse frequency generally comprises a frequency of an input pulse signal, such that the pulse frequency is determined based on accuracy dependent only upon a reference timer clock. The frequency input signal is generally utilized as a clock for a pulse counter and as a capture latch signal for the system free running timer. In so doing, when a pulse occurs, it will increment the pulse counter and latch the current system time at which it occurred. In this manner, a pulse count and an associated pulse time can be captured for the first and last pulses that occur within a predetermined measurement period. In doing so the frequency of the input pulse signal can be calculated by dividing a difference of the start count and the end count captured in the predetermined measurement interval by a difference of the respective captured start time and end time of the same predetermined measurement interval.
Since the accuracy of a pulse frequency measurement is thus limited only to the accuracy of an associated crystal oscillator frequency and a resolution of a reference timer clock with respect to the predetermined measurement period. The pulse count and timer count can thus be captured utilizing at least two free running counters. Each counter can be configured as an integrated circuit counter that provides a low order counting capability. An overflow signal can be directed from one or more of the integrated circuit counters into an interrupt (i.e., interrupt line) of a micro controller to provide higher order counters thereof.
A frequency measurement circuit can be configured to automatically measure the pulse frequency, wherein the frequency measurement circuit comprises a timer clock linked to a first integrated circuit counter. The first integrated circuit counter provides a signal to a comparator and a timer latch. A micro controller contains a time interrupt line, a write line, a read line, a data line, and a pulse overflow interrupt line, wherein the micro controller is connected to the comparator at the write line, the read line, and the time interrupt line and connected to timer latch at the data line. Additionally, a second integrated circuit counter can provide a first output signal to the read line of the micro controller, wherein the read line is connected at least one output line of the timer latch. A second output signal of the second integrated circuit counter is generally provided to the pulse overflow interrupt line of the micro controller. The micro controller comprises a first storage register for storing a high order time count and a second storage register for storing a high order pulse count. The timer clock can be configured as a crystal oscillator, while the second output signal of the second integrated circuit counter comprises an overflow signal.